package com.ereach;

import java.util.PriorityQueue;

public class MainDemo {
    public static void main(String[] args) {
        PriorityQueue<Integer> pQueue = new PriorityQueue<Integer>();

        // Adding items to the pQueue using add()
        pQueue.add(10);
        pQueue.add(20);
        pQueue.add(15);

        System.out.println("===print pQueue");
        System.out.println(pQueue);

        System.out.println("===print top elemement");
        System.out.println(pQueue.peek());
        System.out.println(pQueue);

        System.out.println("===remove top and print it");
        System.out.println(pQueue.poll());
        System.out.println(pQueue);

//        // Printing the top element and removing it
//        // from the PriorityQueue container
//        System.out.println(pQueue.poll());
//
//        // Printing the top element again
//        System.out.println(pQueue.peek());
    }
}
